package com.yang.controller.wx;

import com.yang.bean.MarketUser;
import com.yang.bean.common.BaseRespVo;
import com.yang.bean.zdd.vo.IndexVoInWxVo;
import com.yang.exception.WXException;
import com.yang.service.wx.WXUserService;
import com.yang.utils.UserUtil;
import org.apache.shiro.session.Session;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: 杨庆
 * @since: 2022.9.9 15:19
 * @description:
 */
@RestController
@RequestMapping("wx/user/")
public class WXUserController {
    @Autowired
    WXUserService userService;
    @Autowired
    DefaultWebSessionManager defaultWebSessionManager;


    @RequestMapping("index")
    public BaseRespVo index(HttpServletRequest request) {
        //获取用户信息
        MarketUser user = UserUtil.getUserMsg(request, defaultWebSessionManager);

        IndexVoInWxVo data = userService.index(user.getId());
        return BaseRespVo.ok(data);
    }
}

